const { DataTypes } = require("sequelize");
const sequelize = require("../config/database");

const ActivationCode = sequelize.define("ActivationCode", {
  id: {
    type: DataTypes.INTEGER,
    primaryKey: true,
    autoIncrement: true
  },
  code: {
    type: DataTypes.STRING,
    allowNull: false,
    unique: true,
    comment: '激活码'
  },
  isUsed: {
    type: DataTypes.BOOLEAN,
    defaultValue: false,
    comment: '是否已使用'
  },
  usedBy: {
    type: DataTypes.STRING,
    allowNull: true,
    comment: '使用者'
  }
}, {
  tableName: 'activation_codes',
  timestamps: true
});

module.exports = ActivationCode;
